package com.hioove.test.config;

import com.hioove.core.interceptor.Interceptor;
import com.hioove.core.aop.model.IInterceptorContext;
import com.hioove.core.aop.annotation.Aspect;
import com.hioove.core.aop.annotation.Before;
import com.hioove.core.aop.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Aspect
public class AopTimeConfig extends Interceptor<Long> {
    Logger log = LoggerFactory.getLogger(AopTimeConfig.class);

    @Pointcut
    @Override
    public IInterceptorContext<Long> pointcut(IInterceptorContext<Long> context) {
        long l = System.currentTimeMillis();
        log.info("i am aop-time-config Pointcut!!!" + l);
        return context.setReturnObj(l);
    }

    @Before
    @Override
    public IInterceptorContext<Long> before(IInterceptorContext<Long> context) {
        long l = System.currentTimeMillis();
        log.info("i am aop-time-config before!!!" + l);
        return context.setReturnObj(l);
    }

//    @After
//    @Override
//    public IInterceptorContext<Long> after(IInterceptorContext<Long> context) {
//        long l = System.currentTimeMillis();
//        Long start = context.getReturnObj();
//        log.info("start time:{} end time:{} ", start, l);
//        log.info("i am aop-time-config after!!!");
//        return context.setReturnObj(l);
//    }

}
